﻿

#include<iostream>
#include<string.h>
using namespace std;
struct employee
{
	string number;
	string name;
	string title;
	double wage[15];
};
struct employees
{
	struct employee information[10];
	int size;
};
void mainmenu()
{
	cout << "1.增加职工信息" << endl;
	cout << "2.显示员工信息" << endl;
	cout << "3.删除员工信息" << endl;
	cout << "0.退出管理系统" << endl;
}
void increase(employees* yuan)
{
	int amount;
	cout << "请输入您要添加的员工信息数量" << endl;
	cin >> amount;
	for (int i = 0; i < amount; i++)
	{
		cout << "请输入第" << i + 1 << "位员工的工号，姓名和职位" << endl;
		string number;
		string name;
		string title;
		cin >> number >> name >> title;
		yuan->information[yuan->size].number = number;
		yuan->information[yuan->size].name = name;
		yuan->information[yuan->size].title = title;
		for (int j = 0; j < 15; j++)
			cin >> yuan->information[yuan->size].wage[15];
		yuan->size++;
	}
	cout << "恭喜您，添加信息成功！" << endl;
}
void show(employees* yuan)
{
	if (yuan->size == 0)
	{
		cout << "暂无可查询记录" << endl;
	}
	else
	{
		for (int i = 0; i < yuan->size; i++)
		{
			cout << yuan->information[i].number << " " << yuan->information[i].name << " " << yuan->information[i].title;
			for (int j = 0; j < 15; j++)
				cout << yuan->information[i].wage[j] << " ";
			cout << endl;
		}
	}
}
int exsit(employees* yuan)
{
	cout << "请输入要查找员工的姓名" << endl;
	string name;
	cin >> name;
	if (yuan->size == 0)
	{
		cout << "不存在员工信息" << endl;
		return -1;
	}
	else
	{
		for (int i = 0; i < yuan->size - 1; i++)
		{
			if (yuan->information[i].name == name)
				return i;
		}
	}
}
void idelete(employees* yuan)
{
	int j;
	j = exsit(yuan);
	if (j == -1)
		cout << "查无此人" << endl;
	else
	{
		for (int i = j; i < yuan->size - 1; i++)
		{
			yuan->information[i] = yuan->information[i + 1];
		}
	}
}
int main()
{
	employees yuan;
	//string max=10; 
	yuan.size = 0;
	mainmenu();
	cout << "请选择要进行的操作" << endl;
	int select;
	while (true)
	{
		cin >> select;
		switch (select)
		{
		case 0:
			cout << "欢迎下次使用" << endl;
			system("pause");
			break;
			return 0;
		case  1:
			increase(&yuan);
			break;
		case 2:
			cout << "显示的信息如下" << endl;
			show(&yuan);
			break;
		case 3:
			cout << "删除联系人" << endl;
		}

	}
}
